package com.hudson.plugin.server.hibernateDB.domain.dao;

import com.hudson.plugin.server.hibernateDB.internal.domain.entity.ViewsEntity;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Richard
 * Date: 5/29/11
 * Time: 10:45 PM
 * To change this template use File | Settings | File Templates.
 */
public interface ViewsDAOInterface {
    // property constants
    String ICAFE_PROJECT = "icafeProject";
    String MODULE = "module";
    String VERSION = "version";
    String VIEW_NAME = "viewName";
    String URL = "url";

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    void save(ViewsEntity transientInstance);

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    void delete(ViewsEntity persistentInstance);

    ViewsEntity findById(Integer id);

    List<ViewsEntity> findByProperty(String propertyName, Object value);

    List<ViewsEntity> findByIcafeProject(Object icafeProject);

    List<ViewsEntity> findByModule(Object module);

    List<ViewsEntity> findByVersion(Object version);

    List<ViewsEntity> findByViewName(Object viewName);

    List<ViewsEntity> findByUrl(Object url);

    List<ViewsEntity> findAll();

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    ViewsEntity merge(ViewsEntity detachedInstance);

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    void attachDirty(ViewsEntity instance);

    @Transactional(readOnly = false, propagation = Propagation.REQUIRED)
    void attachClean(ViewsEntity instance);

    List<Integer> findViewsEntityByModuleAndIcafeProject(String moduleName, String icafeProjectName);
}
